using System;
using System.Collections.Generic;

namespace PokerStar.Core
{
    public class Player
    {
        private readonly string _name;
        private Stake _balance;

        public Player(string name)
        {
            _name = name;
            Cards = new List<Card>();
            Reset();
        }

        public IList<Card> Cards { get; private set; }
        public bool Folded { get; private set; }

        public GameResult Result { get; set; }

        public void Reset()
        {
            Cards.Clear();
            Folded = false;
        }

        public void Accept(Card card)
        {
            Cards.Add(card);
        }

        public void Fold()
        {
            Folded = true;
        }

        public void Bet(Stake number)
        {
            //if (_balance > number)
            //{
            //    _balance -= number;
            //}
            throw new NotImplementedException();
        }

        public override string ToString()
        {
            string buffer = "";
            if (Cards.Count != 0)
            {
                foreach (var card in Cards)
                {
                    buffer += card + ", ";
                }
            }
            return string.Format("Player {0}, {1}", _name, buffer);
        }
    }
}